import Vue from 'vue'
import App from './App.vue'
import VueRouter from 'vue-router' //引入路由器
import router from './router'
import store from './store'
import echarts from './api/echarts' //引入echarts
import VueLazyload from 'vue-lazyload'
import { VeCascader } from "v-regions"; //引入省市区联动插件
import local from './api/local' //引入封装的本地存储
//引入重写的message，并挂在原型上
import {Skeleton,SkeletonItem,Empty,Table,TableColumn,Cascader,Input,Popover} from 'element-ui'
import { ElMessage } from '../src/api/message.js'
Vue.prototype.$echarts = echarts
Vue.prototype.$local = local //挂在原型上
Vue.prototype.$message = new ElMessage()
Vue.use(VeCascader); //使用联动插件
Vue.config.productionTip = false
Vue.component('el-skeleton',Skeleton)
Vue.component('el-skeleton-item',SkeletonItem)
Vue.component('el-empty',Empty)
Vue.component('el-table',Table)
Vue.component('el-table-column',TableColumn)
Vue.component('el-cascader',Cascader)
Vue.component('el-input',Input)
Vue.component('el-popover',Popover)
Vue.use(VueRouter) //使用路由器
import lazy from './assets/lzay.gif'
Vue.use(VueLazyload,{ //图片懒加载
  loading: lazy
}) 
new Vue({
  render: h => h(App),
  beforeCreate(){ 
    Vue.prototype.$bus = this //安装全局事件总线(bus)
  },
  router, //引入后可配置router配置项(简写形式)
  store
}).$mount('#app')
// 每次跳转时总在页面顶端
router.afterEach(() => {
  window.scrollTo(0,0);
});

